/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2017-2019. All rights reserved.
 * Description: the log module for demuser
 * Author: HiMobileCam middleware develop team
 * Create: 2017-12-22
 */

#ifndef FFDEMUX_LOG_H
#define FFDEMUX_LOG_H

#include "hi_type.h"

#define MODULE_NAME_DEMUX "ffmpegDemux"

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* End of #ifdef __cplusplus */

/*
 * @brief  log level type.
 */
typedef enum {
    HI_FFDEMUX_LOG_LEVEL_DEBUG = 0,
    HI_FFDEMUX_LOG_LEVEL_INFO,
    HI_FFDEMUX_LOG_LEVEL_WARN,
    HI_FFDEMUX_LOG_LEVEL_ERR,
    HI_FFDEMUX_LOG_LEVEL_FATAL,
    HI_FFDEMUX_LOG_LEVEL_BUTT
}HiFfDemuxLogLevel;

typedef HI_VOID (*HiFfdemuxOutputFunc)(const HI_CHAR *fmt, ...);

/**
*   @brief  set enabled log level, logs with equal or higher level than enabled will be output
*   @param[in] enLevel : HiFfDemuxLogLevel: enabled level
*   @retval  0 success,others failed
 */
HI_S32 FfdemuxSetEnabledLevel(HiFfDemuxLogLevel enLevel);

/**
*   @brief  use this API to set log output function instread of 'printf'
*   @param[in] pFunc : HiFfdemuxOutputFunc: output function implements by user
*   @retval  0 success,others failed
 */
HI_S32 FfdemuxSetOutputFunc(HiFfdemuxOutputFunc func);

/**
*   @brief  output log
*   @param[in] modName : HI_CHAR*: module name
*   @param[in] enLevel : HiFfDemuxLogLevel: log level
*   @param[in] fmt : HI_CHAR*: log content, accept multi-parameters
*   @retval  0 success,others failed
 */
#ifdef ENABLE_LOG
HI_VOID FFDEMUX_PRINTF(const HI_CHAR modName[], HiFfDemuxLogLevel level, const HI_CHAR fmt[],
    ...) __attribute__((format(printf, 3, 4)));
#else
#define FFDEMUX_PRINTF(fmt, ...)
#endif
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */

#endif /* FFDEMUX_LOG_H */
